﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Public/Public.Master" AutoEventWireup="true" CodeBehind="PCategory.aspx.cs" Inherits="NhanAi.Public.PCategory" %>

<%@ Import Namespace="NhanAi.Entity" %>
<%@ Import Namespace="System.Collections.Generic" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <title>Trang chủ</title>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <% string lang = CurrentLanguage; %>
    <%foreach (Taxonomy t in Taxonomies)
      { %>
    <% List<Post> posts = new List<Post>();
       Posts.TryGetValue(t.Id, out posts);       
    %>
    <%if (posts != null && posts.Count > 0)
      { %>
    <div class="content-panel">

        <h2 class="panel-title"><a href="Category.aspx?name=<%=t.Id %>"><%=lang=="vi"?t.TermName:t.TermNameEn %></a></h2>
        <div class="content-box">
            <div class="featured">
                <div class="featured-item clear">
                    <img src="<%=posts[0].Guid %>" class="post-thumbnail left" />
                    <h3 class=""><a href="/Public/Post.aspx?id=<%=posts[0].Id %>&cateId=<%=t.Id %>"><%= lang=="vi"?posts[0].Title:posts[0].TitleEn %></a></h3>
                    <%=lang=="vi"?posts[0].Excerpt:posts[0].ExcerptEn %> ...
                <a href="/Public/Post.aspx?id=<%=posts[0].Id %>&cateId=<%=t.Id %>" class="more">Xem thêm &raquo;</a>
                </div>
                <%if(posts.Count>1){ %>
                 <div class="featured-item clear">
                    <img src="<%=posts[1].Guid %>" class="post-thumbnail left" />
                    <h3 class=""><a href="/Public/Post.aspx?id=<%=posts[1].Id %>&cateId=<%=t.Id %>"><%= lang=="vi"?posts[1].Title:posts[1].TitleEn %></a></h3>
                    <%=lang=="vi"?posts[1].Excerpt:posts[1].ExcerptEn %> ...
                <a href="/Public/Post.aspx?id=<%=posts[1].Id %>&cateId=<%=t.Id %>" class="more">Xem thêm &raquo;</a>
                </div>
                <%} %>
                <%if(posts.Count>2){ %>
                 <div class="featured-item clear">
                    <img src="<%=posts[2].Guid %>" class="post-thumbnail left" />
                    <h3 class=""><a href="/Public/Post.aspx?id=<%=posts[2].Id %>&cateId=<%=t.Id %>"><%= lang=="vi"?posts[2].Title:posts[2].TitleEn %></a></h3>
                    <%=lang=="vi"?posts[2].Excerpt:posts[2].ExcerptEn %> ...
                <a href="/Public/Post.aspx?id=<%=posts[2].Id %>&cateId=<%=t.Id %>" class="more">Xem thêm &raquo;</a>
                </div>
                <%} %>
            </div>
            <div class="title-list none-list">
                <ul>
                    <%if (posts.Count > 3) for (int i = 3; i < posts.Count; i++)
                          { %>
                    <li class="menu-item"><a href="/Public/Post.aspx?id=<%=posts[i].Id %>&cateId=<%=t.Id %>"><%= lang=="vi"?posts[i].Title:posts[i].TitleEn %></a></li>

                    <%} %>
                </ul>
            </div>
        </div>

    </div>
    <%} %>
    <%} %>
</asp:Content>
